package com.vip.mvc.utils.reflection;

import com.vip.mvc.dispacher.RequestParam;
import com.vip.mvc.utils.JSONUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by cloudy.xie on 17/2/14.
 */
public class ClassReflection {
    private String beanName;
    private boolean isController;
    private boolean isService;
    private Class clazz;
    private Object obj;
    private List<RequestParam> requestMapList = new ArrayList<>();

    public boolean isController() {
        return isController;
    }

    public boolean isService() {
        return isService;
    }

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }

    public void setController(boolean controller) {
        isController = controller;
    }

    public void setService(boolean service) {
        isService = service;
    }

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public List<RequestParam> getRequestMapList() {
        return requestMapList;
    }

    public void addRequestMapList(RequestParam requestMap) {
        this.requestMapList.add(requestMap);
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    @Override
    public String toString() {
        try {
            return JSONUtils.toJSON(this);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

}
